<template>
  <div style="padding: 30px">
    <a-row type="flex">
      <a-col flex="100px" @click="goBack"
        ><div style="text-align: left; cursor: pointer">
          <a-icon type="arrow-left" /></div
      ></a-col>
      <a-col flex="auto"> </a-col>
    </a-row>
    <a-descriptions bordered title="Account Balance" :column="1">
      <a-descriptions-item label="Address">
        {{ address }}
      </a-descriptions-item>
      <a-descriptions-item label="Balacne">
        {{ balance }}
      </a-descriptions-item>
    </a-descriptions>
  </div>
</template>


<script>
import Constant from "../utils/Constant";
export default {
  data() {
    return {
      address: null,
      balance: 0,
    };
  },
  created() {
    console.log("created");
    this.address = this.$route.query.address;
    this.getBalance(this.address);
  },
  methods: {
    getBalance(address) {
      let url = Constant.ACCOUNT_BALANCE_URL + address;
      this.$http.get(url).then(
        (resp) => {
          // console.log(resp);
          if (resp.data.code === "01") {
            this.balance = resp.data.result;
          }
        },
        (err) => {
          console.log(err);
        }
      );
    },
    goBack() {
      console.log("go back");
      this.$router.go(-1);
    },
  },
};
</script>
